package com.liyl.service;

import com.liyl.util.DaLeTouUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

/**
 * @author liyl
 */
@Service
@Slf4j
public class DaleTouService {

    @Autowired
    private RedisTemplate<String, Object> redisTemplate;

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public String lottery() {
        return DaLeTouUtils.getDaLeTou();
    }

    public String getValFromRedis(String key) {
        return stringRedisTemplate.opsForValue().get(key);
    }

    public void setValFromRedis(String key, String val) {
        redisTemplate.opsForValue().set(key, val, 60000);
    }
}
